.TH "Slurm API" "3" "Slurm error handling functions" "April 2015" "Slurm error handling functions"

.SH "NAME"
slurm_get_errno, slurm_perror, slurm_strerror \- Slurm error handling functions
.SH "SYNTAX"
.LP
#include <slurm/slurm_errno.h>
.LP
int \fBslurm_get_errno\fR ( );
.LP
void \fBslurm_perror\fR (
.br
	char *\fIheader\fP
.br
);
.LP
char * \fBslurm_strerror\fR (
.br
	int \fIerrnum\fP
.br
);
.SH "ARGUMENTS"
.LP
.TP
\fIerrnum\fP
A Slurm error code.
.TP
\fIheader\fP
A pointer to a string used as a message header for printing along with an error description.
.SH "DESCRIPTION"
.LP
\fBslurm_get_errno\fR Return the error code as set by the Slurm API function executed.
.LP
\fBslurm_perror\fR Print to standard error the supplied header followed by a colon followed by a text description of the last Slurm error code generated.
.LP
\fBslurm_strerror\fR Given a Slurm error code, return a pointer to a text description of the error's meaning.
.SH "RETURN VALUE"
.LP
\fBslurm_get_errno\fR returns an error code or zero if no error was generated by the last Slurm function call executed. \fBslurm_strerror\fR returns a pointer to a text string, which is empty if no error was generated by the last Slurm function call executed.
.SH "EXAMPLE"
.LP
#include <stdio.h>
.br
#include <slurm/slurm.h>
.br
#include <slurm/slurm_errno.h>
.LP
int main (int argc, char *argv[])
.br
{
.br
	/* assume Slurm API function failed here */
.br
	fprintf (stderr, "Slurm function errno = %d\\n",
.br
	         slurm_get_errno ());
.br
	fprintf (stderr, "Slurm function errno = %d %s\\n",
.br
	         slurm_get_errno (),
.br
	         slurm_strerror (slurm_get_errno ()));
.br
	slurm_perror ("Slurm function");
.br
	exit (1);
.br
}

.SH "NOTE"
These functions are included in the libslurm library,
which must be linked to your process for use
(e.g. "cc \-lslurm myprog.c").

.SH "COPYING"
Copyright (C) 2002 The Regents of the University of California.
Produced at Lawrence Livermore National Laboratory (cf, DISCLAIMER).
CODE\-OCEC\-09\-009. All rights reserved.
.LP
This file is part of Slurm, a resource management program.
For details, see <https://slurm.schedmd.com/>.
.LP
Slurm is free software; you can redistribute it and/or modify it under
the terms of the GNU General Public License as published by the Free
Software Foundation; either version 2 of the License, or (at your option)
any later version.
.LP
Slurm is distributed in the hope that it will be useful, but WITHOUT ANY
WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
FOR A PARTICULAR PURPOSE.  See the GNU General Public License for more
details.
.SH "SEE ALSO"
.LP
\fBslurm_allocate_resources\fR(3),
\fBslurm_complete_job\fR(3), \fBslurm_complete_job_step\fR(3),
\fBslurm_allocation_lookup\fR(3),
\fBslurm_free_ctl_conf\fR(3), \fBslurm_free_job_info_msg\fR(3),
\fBslurm_free_job_step_create_response_msg\fR(3),
\fBslurm_free_node_info\fR(3), \fBslurm_free_partition_info\fR(3),
\fBslurm_free_resource_allocation_response_msg\fR(3),
\fBslurm_free_submit_response_response_msg\fR(3),
\fBslurm_get_job_steps\fR(3),
\fBslurm_init_job_desc_msg\fR(3), \fBslurm_init_part_desc_msg\fR(3),
\fBslurm_job_step_create\fR(3), \fBslurm_job_will_run\fR(3),
\fBslurm_kill_job\fR(3), \fBslurm_kill_job_step\fR(3),
\fBslurm_load_ctl_conf\fR(3), \fBslurm_load_jobs\fR(3),
\fBslurm_load_node\fR(3), \fBslurm_load_partitions\fR(3),
\fBslurm_pid2jobid\fR(3),
\fBslurm_reconfigure\fR(3), \fBslurm_shutdown\fR(3), \fBslurm_submit_batch_job\fR(3),
\fBslurm_update_job\fR(3), \fBslurm_update_node\fR(3), \fBslurm_update_partition\fR(3)


